{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "创建第一个视觉程序“Hello，world！”，显示Lena图片"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import cv2\n",
    "img = cv2.imread(r'C:\\Users\\98101\\Desktop\\lena.jpg')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "cv2.imshow('Hellol, world!',img)\n",
    "cv2.waitKey()\n",
    "cv2.destroyAllWindows()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "对Lena图像，分解得到RGB分量及HSV分量，显示各分量，并对结果进行比较说明"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "hsv = cv2.cvtColor(img,cv2.COLOR_BGR2HSV)\n",
    "cv2.imshow(\"Hue\",hsv[:,:,0])\n",
    "cv2.imshow(\"Saturation\",hsv[:,:,1])\n",
    "cv2.imshow(\"Value\",hsv[:,:,2])\n",
    "cv2.imshow(\"B\",img[:,:,0])\n",
    "cv2.imshow(\"G\",img[:,:,1])\n",
    "cv2.imshow(\"R\",img[:,:,2])\n",
    "cv2.waitKey()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "RGB显示的是红(R)、绿(G)、蓝(B)三个颜色通道\n",
    "HSV显示的是色度、饱和度、明度三个通道\n",
    "分类不一致所以图像有区别"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
